﻿@using System.Text;

@inject PointService pointService
@{
    var userPointList = ViewData["UserPointList"] as UserPointHistory;

    StringBuilder tipBuilder = new StringBuilder();

    if (userPointList != null && !userPointList.Remark.IsNullOrWhiteSpace()) {
        // tipBuilder.Append("<h3>");
        tipBuilder.Append("<strong>");

        if (!userPointList.PointStrategyId.IsNullOrWhiteSpace())
        {
            tipBuilder.Append("<span class=\"text-primary\">");
            tipBuilder.Append(pointService.GetPointStrategyAsync(userPointList.PointStrategyId).GetAwaiter().GetResult().Name);
            tipBuilder.Append("</span>");
        }
        if (userPointList.Exp != 0)
        {
            tipBuilder.Append($" 经验值 <span class=\"text-danger\">{userPointList.Exp.GetPositiveNumString()}</span> ");
        }

        if (userPointList.TradingPoints != 0)
        {
            tipBuilder.Append($" 金币 <span class=\"text-danger\">{userPointList.TradingPoints.GetPositiveNumString()}</span> ");
        }

        tipBuilder.Append("</strong>");
        // tipBuilder.Append("</h3>");
    }
}

@if (userPointList != null) { 
    <script type="text/javascript">
        layer.msg('@Html.Raw(tipBuilder.ToString())', {icon:1});
    </script>
}